import Vue from 'vue'
import axios from 'axios'

//拦截器
axios.interceptors.request.use(function(request){
    //获取token
    var tokenString = localStorage.getItem('logindata') || '{}'
    var token = JSON.parse(tokenString).token
    if(token){
        request.headers.Authorization = token
    }return request
})

axios.interceptors.response.use(function(response){
    return response.data
})



/* axios.defaults.baseURL='http://127.0.0.1:3766' */
/* axios.defaults.baseURL='http://127.0.0.1:3766' */
/* axios.defaults.baseURL='http://127.0.0.1:3766' */
/* axios.defaults.baseURL='http://127.0.0.1:3766' */
/* axios.defaults.baseURL='http://127.0.0.1:3766' */
Vue.prototype.$http = axios
Vue.prototype.static_host = 'http://127.0.0.1:3766'
export default axios